package net.risesoft.risebi.collection.web.admin;

import java.sql.Types;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import net.risesoft.risebi.collection.model.Application;
import net.risesoft.risebi.collection.model.Catalog;
import net.risesoft.risebi.collection.model.DbColumn;
import net.risesoft.risebi.collection.model.ReportInstance;
import net.risesoft.risebi.collection.model.ReportPeriod;
import net.risesoft.risebi.collection.model.ReportPeriodType;
import net.risesoft.risebi.collection.model.SoCollection;
import net.risesoft.risebi.collection.model.StatisticalObjectTree;
import net.risesoft.risebi.collection.model.Template;
import net.risesoft.risebi.collection.model.User;
import net.risesoft.risebi.collection.service.ApplicationManager;
import net.risesoft.risebi.collection.service.CatalogManager;
import net.risesoft.risebi.collection.service.DataOperationManager;
import net.risesoft.risebi.collection.service.DbMetaDataManager;
import net.risesoft.risebi.collection.service.DynaBeanManager;
import net.risesoft.risebi.collection.service.EmployeeSoCollectionManager;
import net.risesoft.risebi.collection.service.ReportInstanceManager;
import net.risesoft.risebi.collection.service.ReportPeriodManager;
import net.risesoft.risebi.collection.service.ReportPeriodTypeManager;
import net.risesoft.risebi.collection.service.ReportWindowPeriodManager;
import net.risesoft.risebi.collection.service.SoCollectionManager;
import net.risesoft.risebi.collection.service.SoInstanceManager;
import net.risesoft.risebi.collection.service.SoTypeManager;
import net.risesoft.risebi.collection.service.StatisticalObjectTreeManager;
import net.risesoft.risebi.collection.service.StatisticalObjectTreeNodeManager;
import net.risesoft.risebi.collection.service.TemplateManager;
import net.risesoft.risebi.collection.service.UserSOManager;
import net.risesoft.risebi.collection.web.BaseAction;
import net.risesoft.risebi.commons.util.JSONUtil;

@Namespace("/admin/ReportWriteQueryAction")
public class ReportWriteQueryAction extends BaseAction {
	private final Log log = LogFactory.getLog(DataQueryAction.class);

	private Catalog catalog;
	private DbMetaDataManager dbMetaDataManager;
	private SoTypeManager soTypeManager;
	private ReportWindowPeriodManager reportWindowPeriodManager;
	private UserSOManager userSOManager;
	private ReportInstanceManager reportInstanceManager;
	private TemplateManager templateManager;
	private DataOperationManager dataOperationManager;
	private ReportPeriodTypeManager reportPeriodTypeManager;
	private ReportPeriodManager reportPeriodManager;
	private EmployeeSoCollectionManager employeeSoCollectionManager;
	private SoCollectionManager soCollectionManager;
	private ApplicationManager applicationManager;
	private CatalogManager catalogManager;
	private StatisticalObjectTreeNodeManager statisticalObjectTreeNodeManager;
	private StatisticalObjectTreeManager statisticalObjectTreeManager;
	private SoInstanceManager soInstanceManager;
	private ReportInstance reportInstance;
	private DynaBeanManager dynaBeanManager;

	private String currentServiceGuid;
	private String applicationGuid;

	private String soCollectionGuid;
	private String json_application;
	private String json_reportPeriodType;
	private String json_template;
	private String json_reportPeriod;
	private String json_soCollection;
	private String json_soType;
	private String json_sot; // 统计对象树

	private String reportperiodType;

	public String template_guid;

	public String reportperiod_guid;
	public String status;

	@Action(value="reportWriteQuery",
			results={@Result(name="success", location="/client/datapage/reportWriteQuery.jsp")}
	)
	public String reportWriteQuery() throws Exception {

		this.currentServiceGuid = this.getDefaultService().getGuid();
		this.applicationGuid = this.getDefaultApp().getGuid();

		List<Application> applicationList = (List<Application>) applicationManager
				.find(" from Application s where s.service.guid='"
						+ this.currentServiceGuid + "'");
		this.json_application = JSONUtil.getJsonString("include",
				"guid,chineseName", applicationList);

		List<ReportPeriodType> reportPeriodTypeList = reportPeriodTypeManager
				.find("from ReportPeriodType s where s.service.guid='"
						+ currentServiceGuid + "'");
		this.json_reportPeriodType = JSONUtil.getJsonString("include",
				"guid,name", reportPeriodTypeList);

		// List<Template> lst2 =
		// templateManager.getTemplatesByApplication(this.applicationGuid);

		List<SoCollection> soCollectionList = soCollectionManager
				.find(" from SoCollection s where s.application.guid='"
						+ this.applicationGuid + "'");
		this.json_soCollection = JSONUtil.getJsonString("include", "guid,name",
				soCollectionList);

		List<Catalog> catalogList = catalogManager
				.find(" from Catalog c where c.type='1' and c.service.guid='"
						+ this.currentServiceGuid + "' and c.application.guid='"+this.applicationGuid+"'");
		this.json_soType = JSONUtil.getJsonString("include", "guid,name",
				catalogList);

		List<StatisticalObjectTree> sotlst = statisticalObjectTreeManager
				.getAllByApp(this.applicationGuid);
		this.json_sot = JSONUtil.getJsonString("include", "guid,name", sotlst);

		return SUCCESS;
	}

	@Action(value="refreshJson")
	public String refreshJson() throws Exception {
		try {
			this.currentServiceGuid = this.getDefaultService().getGuid();
			this.applicationGuid = this.getDefaultApp().getGuid();

			if ("reportPeriodType".equalsIgnoreCase(this.whichJson)) {

				List<ReportPeriodType> lst = reportPeriodTypeManager
						.find("from ReportPeriodType s where s.service.guid='"
								+ currentServiceGuid + "'");
				this.json_reportPeriodType = JSONUtil.getJsonString("include",
						"guid,name", lst);

				List<Template> lst2 = templateManager
						.getTemplatesByApplication(this.applicationGuid);
				// templateManager.find(" from Template t where t.reportPeriodType.guid='"+)
				this.json_template = JSONUtil.getJsonString("include",
						"guid,code", lst2);

			} else if ("template".equalsIgnoreCase(this.whichJson)) {
				List<Template> lst = templateManager
						.find(" from Template t where t.reportPeriodType.guid='"
								+ this.node
								+ "' and t.application.guid='"
								+ this.applicationGuid + "'");
				this.json = JSONUtil.getJsonString("include", "guid,code", lst);
			} else if ("periodInstance".equalsIgnoreCase(this.whichJson)) {
				List<ReportPeriod> lst = reportPeriodManager
						.find("from ReportPeriod rp where rp.reportPeriodType.guid='"
								+ this.node + "'");
				this.json = JSONUtil.getJsonString("include", "guid,name", lst);
			}
		} catch (Exception e) {
			this.json_reportPeriodType = "[]";
			e.printStackTrace();
		}

		return AJAX;
	}

	@Action(value="reportQuery",
			results={@Result(name="success", location="/client/datapage/reportWriteQueryResult.jsp")}
	)
	public String reportQuery() throws Exception {
		return SUCCESS;
	}

	@Action(value="query")
	public String query() throws Exception {

		User user = getSessionUser();
		catalog = (Catalog) catalogManager.getObject(Catalog.class, node);
		String tableName = catalog.getTableName().trim().toLowerCase();
		
		String filterHql = " t.item_guid in (select r.soInstance.guid  from ReportInstance r "
				+ " where r.template.guid='" + this.getTemplate_guid()+ "' and "
				+ "       r.reportPeriod.guid='"+ this.getReportperiod_guid()+"' and "
				+ "       r.status='"+ this.getStatus()+"' ) ";
		if( this.soCollectionGuid!=null&&!this.soCollectionGuid.trim().equals(""))
			filterHql+= " and       t.item_guid in (select soc.so_instance_guid from  SoCollectionMember soc where soc.soCollection.guid='"
				+ this.soCollectionGuid + "')";

		Map map = dynaBeanManager.getPagedSoInstances(tableName, "t", "",
				filterHql, this.start, this.limit);
		// Map map = (Map)dynaBeanManager.getPagedCatalogItems(tableName, where,
		// start, limit);
		this.json = JSONUtil.getJsonString(null, null, map);
		
		// List<ReportInstance> lst=reportInstanceManager.find(hql);
		// Map map = (Map)catalogManager.getPagedCatalog(catalog, start, limit);
		// this.json =
		// JSONUtil.getJsonString("exclude","application,soType,service,template",map);
		// this.json = JSONUtil.getJsonString("include","item_guid",lst); //
		// 取soInstance ,因为在ReportInstance 中 soInstance 的get
		// 和set方法的名字改了（getItem_guid)
		// this.json = JSONUtil.getJsonString("include","item_guid",lst);
		// log.debug("query:   "+json);
		return AJAX;

	}

	@Action(value="buildGridConfig")
	public String buildGridConfig() throws Exception {

		catalog = (Catalog) catalogManager.getObject(Catalog.class, this.node);
		String tableName = catalog.getTableName().trim().toLowerCase();

		StringBuilder gridConfig = new StringBuilder();
		try {
			gridConfig
					.append("{xtype: 'editorgrid', clicksToEdit: 1, id: 'gridId', border: true");
			// gridConfig.append(",sm : sm");
			gridConfig
					.append(",viewConfig : {forceFit:true,autofill:true,emptyText:'没有数据!'}");
			// gridConfig.append(",listeners : {'validateedit' : function(e){return false;}}");
			gridConfig.append(",loadMask : {msg:'正在获取数据，请稍等...'}");

			StringBuilder fieldsStore = new StringBuilder();
			StringBuilder fieldsCm = new StringBuilder();
			fieldsCm.append("sm,");

			List<DbColumn> lst = dbMetaDataManager.listAllColumns(tableName);
			for (DbColumn d : lst) {
				String column_name = d.getColumn_name().trim().toLowerCase();
				String column_caption = d.getComment().trim().toLowerCase();
				boolean hidden = false;
				// if(column_name.endsWith("guid")) hidden = true;
				// 如果是guid字段，则不列出来，如果以后要做上报情况定制，可以再此处作修改。
				if (column_name.endsWith("guid"))
					continue;
				
				if(column_name.endsWith("code")||column_name.endsWith("name")){
					
				}else{
					continue;
				}
					
				switch (d.getData_type()) {
				// 整型
				case Types.TINYINT:
				case Types.SMALLINT:
				case Types.INTEGER:
				case Types.BIGINT:
					fieldsStore.append("{name: '" + column_name
							+ "',type: 'int'},");
					fieldsCm
							.append("{id: '"
									+ column_name
									+ "', header: '"
									+ column_caption
									+ "', width: 100, sortable: true,resizable:true, dataIndex: '"
									+ column_name
									+ "', editor: new Ext.form.NumberField({allowDecimals:false,decimalPrecision:4,allowNegative:false,allowBlank: true})},");
					break;
				// 浮点型
				case Types.FLOAT:
				case Types.REAL:
				case Types.DOUBLE:
				case Types.NUMERIC:
				case Types.DECIMAL:
					fieldsStore.append("{name: '" + column_name
							+ "',type: 'float'},");
					fieldsCm
							.append("{id: '"
									+ column_name
									+ "', header: '"
									+ column_caption
									+ "', width: 100, sortable: true,resizable:true, dataIndex: '"
									+ column_name
									+ "', editor: new Ext.form.NumberField({allowDecimals:true,decimalPrecision:4,allowNegative:true,allowBlank: true})},");
					break;
				// 字符串
				case Types.CHAR:
				case Types.VARCHAR:
					// case Types.NCHAR:
					// case Types.NVARCHAR:
					fieldsStore.append("{name: '" + column_name
							+ "',type: 'string'},");
					fieldsCm
							.append("{id: '"
									+ column_name
									+ "', header: '"
									+ column_caption
									+ "', hidden : "
									+ hidden
									+ ", width: 100, sortable: true,resizable:true, dataIndex: '"
									+ column_name
									+ "', editor: new Ext.form.TextField({allowBlank: true})},");
					break;
				case Types.LONGVARCHAR:
					// case Types.LONGNVARCHAR:
					// fieldsStore.append("{name: '" + column_name +
					// "',type: 'string'},");
					// fieldsCm.append("{id: '" + column_name + "', header: '" +
					// column_caption +
					// "', width: 100, sortable: true, dataIndex: '" +
					// column_name + "'},");
					break;
				// BOOLEAN
				case Types.BIT:
				case Types.BOOLEAN:
					fieldsStore.append("{name: '" + column_name
							+ "',type: 'boolean'},");
					fieldsCm
							.append("{id: '"
									+ column_name
									+ "', header: '"
									+ column_caption
									+ "', width: 100, sortable: true, resizable:true,dataIndex: '"
									+ column_name
									+ "', editor: new Ext.form.TextField({allowBlank: true})},");
					break;
				// 日期型
				case Types.DATE:
					fieldsStore.append("{name: '" + column_name
							+ "',type: 'date',dateFormat: 'Y-m-d H:i:s'},");
					fieldsCm
							.append("{id: '"
									+ column_name
									+ "', header: '"
									+ column_caption
									+ "', width: 100, sortable: true, resizable:true,dataIndex: '"
									+ column_name
									+ "', renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'), editor: new Ext.form.TextField({allowBlank: true})},");
					break;
				case Types.TIME:
					fieldsStore.append("{name: '" + column_name
							+ "',type: 'date',dateFormat: 'H:i:s'},");
					fieldsCm
							.append("{id: '"
									+ column_name
									+ "', header: '"
									+ column_caption
									+ "', width: 100, sortable: true,resizable:true, dataIndex: '"
									+ column_name
									+ "', renderer: Ext.util.Format.dateRenderer('H:i:s'), editor: new Ext.form.TextField({allowBlank: true})},");
					break;
				case Types.TIMESTAMP:
					fieldsStore.append("{name: '" + column_name
							+ "',type: 'date',dateFormat: 'Y-m-d H:i:s'},");
					fieldsCm
							.append("{id: '"
									+ column_name
									+ "', header: '"
									+ column_caption
									+ "', width: 100, sortable: true, resizable:true,dataIndex: '"
									+ column_name
									+ "', renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'), editor: new Ext.form.TextField({allowBlank: true})},");
					break;
				// blob
				case Types.BLOB:
					// fieldsStore.append("{name: '" + column_name +
					// "',type: 'string'},");
					// fieldsCm.append("{id: '" + column_name + "', header: '" +
					// column_caption +
					// "', width: 100, sortable: true, dataIndex: '" +
					// column_name + "'},");
					break;
				// clob
				case Types.CLOB:
					// fieldsStore.append("{name: '" + column_name +
					// "',type: 'string'},");
					// fieldsCm.append("{id: '" + column_name + "', header: '" +
					// column_caption +
					// "', width: 100, sortable: true, dataIndex: '" +
					// column_name + "'},");
					break;
				default:
					// fieldsStore.append("{name: '" + column_name +
					// "',type: 'string'},");
					// fieldsCm.append("{id: '" + column_name + "', header: '" +
					// column_caption +
					// "', width: 100, sortable: true, dataIndex: '" +
					// column_name + "'},");
				}
			}
			// fieldsStore.append("{name: '" + "count" + "',type: 'string'},");
			// fieldsCm.append("{id: '" + "count" + "', header: '" + "count" +
			// "', hidden : " + "true" +
			// ", width: 100, sortable: true, dataIndex: '" + "count" +
			// "', editor: new Ext.form.TextField({allowBlank: true})},");

			String fieldsStore2 = fieldsStore.toString();
			String fieldsCm2 = fieldsCm.toString();
			if (fieldsStore2.endsWith(",")) {
				fieldsStore2 = fieldsStore2.substring(0,
						fieldsStore2.length() - 1);
			}
			if (fieldsCm2.endsWith(",")) {
				fieldsCm2 = fieldsCm2.substring(0, fieldsCm2.length() - 1);
			}
			gridConfig
					.append(",store : new Ext.data.Store({")
					.append("storeId : 'storeId'")
					.append(
							",url : '"
									+ this.getContextPath()
									+ "/admin/ReportWriteQueryAction/query.action?reportperiod_guid="
									+ this.reportperiod_guid
									+ "&template_guid=" + this.template_guid
									+ "&soCollectionGuid="
									+ this.soCollectionGuid + "&status="
									+ this.status + "'")
					.append(",autoLoad : {params: {start: 0,limit: 35} }")
					.append(
							",sm: new Ext.grid.RowSelectionModel({singleSelect:false})")
					.append(",plugins: [new Ext.ux.grid.GridHeaderFilters()]")
					.append(",autoExpandColumn: 'description'")
					.append(",baseParams : {node: '" + this.node + "'}")
					.append(",reader: new Ext.data.JsonReader({")
					.append("  totalProperty : 'count'")
					.append("  ,root : 'list'")
					.append("  ,fields : [")
					.append(fieldsStore2)
					.append("   ]")
					.append("  })")
					.append("})")
					.append(",columns : [")
					.append(fieldsCm2)
					.append("]")
					.append(
							",tbar: [{text: '导出excel', cls:'x-btn-text-icon',icon: '"
									+ this.getContextPath()
									+ "/images/system/fam/page_white_excel.png',iconAlign: 'top',handler: function(){win.show();} },{text: '催报', cls:'x-btn-text-icon',icon: '"
									+ this.getContextPath()
									+ "/images/system/fam/disk.png',iconAlign: 'top',handler: handlerButtonOk }]")
					.append(",bbar : new Ext.PagingToolbar({").append(
							"   store: Ext.StoreMgr.lookup('storeId')").append(
							"   ,id: 'pagingToolbarId'").append(
							"   ,pageSize: 35").append("   ,displayInfo: true")
					.append("   ,plugins : new Ext.ux.Andrie.pPageSize()")
					.append("})").append("}");

			this.json = gridConfig.toString();
		} catch (Exception e) {
			this.json = "";
			e.printStackTrace();
		}
		return AJAX;
	}

	public SoTypeManager getSoTypeManager() {
		return soTypeManager;
	}

	public void setSoTypeManager(SoTypeManager soTypeManager) {
		this.soTypeManager = soTypeManager;
	}

	public ReportWindowPeriodManager getReportWindowPeriodManager() {
		return reportWindowPeriodManager;
	}

	public void setReportWindowPeriodManager(
			ReportWindowPeriodManager reportWindowPeriodManager) {
		this.reportWindowPeriodManager = reportWindowPeriodManager;
	}

	public UserSOManager getUserSOManager() {
		return userSOManager;
	}

	public void setUserSOManager(UserSOManager userSOManager) {
		this.userSOManager = userSOManager;
	}

	public ReportInstanceManager getReportInstanceManager() {
		return reportInstanceManager;
	}

	public void setReportInstanceManager(
			ReportInstanceManager reportInstanceManager) {
		this.reportInstanceManager = reportInstanceManager;
	}

	public TemplateManager getTemplateManager() {
		return templateManager;
	}

	public void setTemplateManager(TemplateManager templateManager) {
		this.templateManager = templateManager;
	}

	public DataOperationManager getDataOperationManager() {
		return dataOperationManager;
	}

	public void setDataOperationManager(
			DataOperationManager dataOperationManager) {
		this.dataOperationManager = dataOperationManager;
	}

	public ReportPeriodTypeManager getReportPeriodTypeManager() {
		return reportPeriodTypeManager;
	}

	public void setReportPeriodTypeManager(
			ReportPeriodTypeManager reportPeriodTypeManager) {
		this.reportPeriodTypeManager = reportPeriodTypeManager;
	}

	public ReportPeriodManager getReportPeriodManager() {
		return reportPeriodManager;
	}

	public void setReportPeriodManager(ReportPeriodManager reportPeriodManager) {
		this.reportPeriodManager = reportPeriodManager;
	}

	public EmployeeSoCollectionManager getEmployeeSoCollectionManager() {
		return employeeSoCollectionManager;
	}

	public void setEmployeeSoCollectionManager(
			EmployeeSoCollectionManager employeeSoCollectionManager) {
		this.employeeSoCollectionManager = employeeSoCollectionManager;
	}

	public SoCollectionManager getSoCollectionManager() {
		return soCollectionManager;
	}

	public void setSoCollectionManager(SoCollectionManager soCollectionManager) {
		this.soCollectionManager = soCollectionManager;
	}

	public ApplicationManager getApplicationManager() {
		return applicationManager;
	}

	public void setApplicationManager(ApplicationManager applicationManager) {
		this.applicationManager = applicationManager;
	}

	public CatalogManager getCatalogManager() {
		return catalogManager;
	}

	public void setCatalogManager(CatalogManager catalogManager) {
		this.catalogManager = catalogManager;
	}

	public StatisticalObjectTreeNodeManager getStatisticalObjectTreeNodeManager() {
		return statisticalObjectTreeNodeManager;
	}

	public void setStatisticalObjectTreeNodeManager(
			StatisticalObjectTreeNodeManager statisticalObjectTreeNodeManager) {
		this.statisticalObjectTreeNodeManager = statisticalObjectTreeNodeManager;
	}

	public StatisticalObjectTreeManager getStatisticalObjectTreeManager() {
		return statisticalObjectTreeManager;
	}

	public void setStatisticalObjectTreeManager(
			StatisticalObjectTreeManager statisticalObjectTreeManager) {
		this.statisticalObjectTreeManager = statisticalObjectTreeManager;
	}

	public SoInstanceManager getSoInstanceManager() {
		return soInstanceManager;
	}

	public void setSoInstanceManager(SoInstanceManager soInstanceManager) {
		this.soInstanceManager = soInstanceManager;
	}

	public ReportInstance getReportInstance() {
		return reportInstance;
	}

	public void setReportInstance(ReportInstance reportInstance) {
		this.reportInstance = reportInstance;
	}

	public String getSoCollectionGuid() {
		return soCollectionGuid;
	}

	public void setSoCollectionGuid(String soCollectionGuid) {
		this.soCollectionGuid = soCollectionGuid;
	}

	public String getJson_application() {
		return json_application;
	}

	public void setJson_application(String json_application) {
		this.json_application = json_application;
	}

	public String getJson_reportPeriodType() {
		return json_reportPeriodType;
	}

	public void setJson_reportPeriodType(String json_reportPeriodType) {
		this.json_reportPeriodType = json_reportPeriodType;
	}

	public String getJson_template() {
		return json_template;
	}

	public void setJson_template(String json_template) {
		this.json_template = json_template;
	}

	public String getJson_reportPeriod() {
		return json_reportPeriod;
	}

	public void setJson_reportPeriod(String json_reportPeriod) {
		this.json_reportPeriod = json_reportPeriod;
	}

	public String getCurrentServiceGuid() {
		return currentServiceGuid;
	}

	public void setCurrentServiceGuid(String currentServiceGuid) {
		this.currentServiceGuid = currentServiceGuid;
	}

	public String getApplicationGuid() {
		return applicationGuid;
	}

	public void setApplicationGuid(String applicationGuid) {
		this.applicationGuid = applicationGuid;
	}

	public String getJson_soCollection() {
		return json_soCollection;
	}

	public void setJson_soCollection(String json_soCollection) {
		this.json_soCollection = json_soCollection;
	}

	public String getJson_soType() {
		return json_soType;
	}

	public void setJson_soType(String json_soType) {
		this.json_soType = json_soType;
	}

	public String getReportperiodType() {
		return reportperiodType;
	}

	public void setReportperiodType(String reportperiodType) {
		this.reportperiodType = reportperiodType;
	}

	public Catalog getCatalog() {
		return catalog;
	}

	public void setCatalog(Catalog catalog) {
		this.catalog = catalog;
	}

	public DbMetaDataManager getDbMetaDataManager() {
		return dbMetaDataManager;
	}

	public void setDbMetaDataManager(DbMetaDataManager dbMetaDataManager) {
		this.dbMetaDataManager = dbMetaDataManager;
	}

	public DynaBeanManager getDynaBeanManager() {
		return dynaBeanManager;
	}

	public void setDynaBeanManager(DynaBeanManager dynaBeanManager) {
		this.dynaBeanManager = dynaBeanManager;
	}

	public String getJson_Sot() {
		return json_sot;
	}

	public void setJson_Sot(String json_Sot) {
		this.json_sot = json_Sot;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getTemplate_guid() {
		return template_guid;
	}

	public void setTemplate_guid(String template_guid) {
		this.template_guid = template_guid;
	}

	public String getReportperiod_guid() {
		return reportperiod_guid;
	}

	public void setReportperiod_guid(String reportperiod_guid) {
		this.reportperiod_guid = reportperiod_guid;
	}
}
